import sequtils
type
  Pos = tuple[x, y: int]

proc valid(pos: Pos): bool =
  pos.x in {0..7} and pos.y in {0..7}

proc valid(white, black: Pos) =
  if not (valid(white) and valid(black) and white != black):
    raise newException(ValueError, "invalid pos") 

proc canAttack*(white, black: Pos): bool =
  valid(white, black)
  
  white.x == black.x or white.y == black.y or
    abs(white.x - black.x) == abs(white.y - black.y)

proc board*(white, black: Pos): seq[string] =
  valid(white, black)

  result = repeat("________", 8)
  result[white.x][white.y] = 'W'
  result[black.x][black.y] = 'B'
